#ifndef COUNTDOWNLATCH_H
#define COUNTDOWNLATCH_H
#pragma once

#include "threadcondition.h"
#include "../lock/mutexlockguard.h"
#include "../prohibitassignment.h"


/**
 * 倒计时闩锁
 * @brief The CountDownLatch class
 */
class CountDownLatch: public ProhibitAssignment
{
public:
    explicit CountDownLatch(int count);
    void wait();
    void countDown();

private:
    mutable MutexLock mutex_;
    ThreadCondition condition_;
    int count_;
};

#endif // COUNTDOWNLATCH_H
